<template>
  <el-button type="primary" @click="getData">请求数据</el-button>
  <el-table :data="tableData" style="width: 100%" border>
    <el-table-column prop="id" label="编号" />
    <el-table-column prop="name" label="书名" />
    <el-table-column prop="author" label="作者" />
  </el-table>
</template>

<script setup>
import request from './axios/request'
import { ref } from 'vue'
let tableData = ref([])
const getData = () => {
  // 请求我们的数据
  request({
    url: '/mock/getBooks',
    method: 'get',
  }).then((res) => {
    console.log(res);
    //真正的数据列表在 res.data.data中
    tableData.value = res.data.data
  })
}
</script>

<style></style>